<template>
  <el-row :gutter="20">
    <el-col :span="24" >
      <el-form ref="form" :model="form" label-width="80px" @submit.prevent style="margin:20px;width:60%;min-width:600px;">
        <el-form-item label="名称">
          <el-input v-model="form.title"></el-input>
        </el-form-item>
        <el-form-item label="首页公告">
          <el-input v-model="form.notice"></el-input>
        </el-form-item>
        <el-form-item label="联系电话">
          <el-input v-model="form.phone"></el-input>
        </el-form-item>
        <el-form-item label="营业时间">
          <el-input v-model="form.time"></el-input>
        </el-form-item>
        <el-form-item label="地址">
          <el-input type="textarea" v-model="form.address"></el-input>
        </el-form-item>

        <el-form-item>
          <el-button type="primary" @click="onSubmit">保存</el-button>
          <el-button @click.native.prevent>取消</el-button>
        </el-form-item>
      </el-form>
    </el-col>
  </el-row>
</template>


<script>
  import { getinfodata, setinfodata } from '@/api/wxdata'

  export default {
    data() {
      return {
        form: {}
      }
    },
    created: function() {
      this.onLound();
    },
    methods: {
      onLound(){
        getinfodata().then(response => {
          this.form = response.data
        })
      },
      onSubmit() {
        setinfodata(this.form).then(response => {
          this.$message.success(response.msg);
        })
      }
    }
  }
</script>


<style scoped>
  .el-col{ margin-bottom:15px; padding-bottom:15px;}
</style>
